package routing;

import geocoding.CustomNodes;

import java.util.ArrayList;

import android.location.Location;

public class Landmarks {
	String TAG="URNav";


	
	
	public void setLandmarks(CustomNodes cn, Trip myTrip){
		
		for (int tripItem=0; tripItem<myTrip.getTripList().size(); tripItem++){
//			int thisNode = myTrip.getTripList().get(i);
			Location thisLocation = new Location("x");
			thisLocation.setLatitude(cn.getDlati(myTrip.getTripList().get(tripItem)));
			thisLocation.setLongitude(cn.getDlongi(myTrip.getTripList().get(tripItem)));
			for (int allItems=0; allItems<cn.getSize(); allItems++){
				
				boolean doNotAdd=false;
				
				if (myTrip.getTripList().get(tripItem) == allItems){
					doNotAdd=true;
//					Log.i(TAG, "Do not add weil " + myTrip.getTripList().get(i) + " == " + j);
				}
				
				if(myTrip.isItemInTrip(allItems)==true){
//					Log.i(TAG, "Check if " + myOsmReader.getNodes().getOsmID(j) + " is in Trip: " + myTrip.isItemInTrip(j));
					
					doNotAdd=true;
				}
				Location checkLocation = new Location ("x");
				checkLocation.setLatitude(cn.getDlati(allItems));
				checkLocation.setLongitude(cn.getDlongi(allItems));
				
				if ((thisLocation.distanceTo(checkLocation)<25) && doNotAdd==false && cn.getHas_tags(allItems) == true){
					cn.setHas_landmark(myTrip.getTripItem(tripItem), true);
//					Log.i(TAG, "setHasLandmark true für " + myOsmReader.getNodes().getOsmID(myTrip.getTripItem(i)));
					cn.setDist_landmark(myTrip.getTripItem(tripItem), allItems);
					for (int k=0; k<cn.getValueSize(myTrip.getTripList().get(tripItem)); k++) {
						cn.setTag_from_lm(myTrip.getTripItem(tripItem), cn.getTag(myTrip.getTripItem(tripItem), k));
					}
					
				}
			}
		}
		
		
	}

	
}
